package com.example.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginCheckServlet3 extends HttpServlet{
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		String username = req.getParameter("username");
		String password = req.getParameter("password");
		System.out.println(username+","+password);
		
		// 得到一个字符输出流
		PrintWriter pw = resp.getWriter();
		
		// 判断用户名密码
		if(username.equals("admin")&&password.equals("123456"))
		{
			// 输出到网页上
			pw.write("login OK");
		}
		else
		{
			pw.write("login Fail");
		}
	}

}
